package org.apache.beam.examples.Models;


import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;

public class QualityRuleColData implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 针对字段的设置
     */
    private QualityRuleDetailModel detailModel;

    /**
     * 一个字段数据的内容
     */
    private Map<String, Object> dataMap = new HashMap<>();

    public QualityRuleColData(Map<String, Object> dataMap, QualityRuleDetailModel detailModel) {
        this.dataMap = dataMap;
        this.detailModel = detailModel;
    }

    public QualityRuleColData() {
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", QualityRuleColData.class.getSimpleName() + "[", "]")
                .add("detailModel=" + detailModel)
                .add("dataMap=" + dataMap)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        QualityRuleColData that = (QualityRuleColData) o;
        return Objects.equals(getDetailModel(), that.getDetailModel()) && Objects.equals(getDataMap(), that.getDataMap());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getDetailModel());
        result = 31 * result + Objects.hashCode(getDataMap());
        return result;
    }

    public QualityRuleDetailModel getDetailModel() {
        return detailModel;
    }

    public void setDetailModel(QualityRuleDetailModel detailModel) {
        this.detailModel = detailModel;
    }

    public Map<String, Object> getDataMap() {
        return dataMap;
    }

    public void setDataMap(Map<String, Object> dataMap) {
        this.dataMap = dataMap;
    }
}
